package com.itjin.health.common;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.itjin.health.exception.ErrorCode;

import java.io.Serializable;

// 全局响应封装类
public class BaseResponse<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonProperty("code")
    private int code;

    @JsonProperty("data")
    private T data;

    @JsonProperty("message")
    private String message;

    public BaseResponse(int code,T data,String message){
        this.code=code;
        this.data=data;
        this.message=message;
    }

    public BaseResponse(int code,T data){
        this(code,data,"");
    }

    public BaseResponse(ErrorCode errorCode){

        this(errorCode.getCode(),null, errorCode.getMessage());
    }



}